package java_9_9;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Test_5{
    public static void main(String[] args) {
        Map<String ,String> m=new HashMap<>();
        m.put("小猪","pig");
        m.put("小狗","dog");
        m.put("小绵羊","sheap");
        m.put("小蛇","snake");
        Scanner in=new Scanner(System.in);
        System.out.println("请输入一个动物名称");
        String a=in.next();
        Object o = m.get(a);
        System.out.println(o);
        boolean b = m.containsKey(a);
        if (b==true){
            System.out.println("找到了");
        }else{
            System.out.println("没有找到");
        }
        System.out.println(">>>>>>>>>>>>>>>>>>>");
        Set<Map.Entry<String,String>>e=m.entrySet();
        System.out.println("请输入英文");
        if (!(m.containsValue(in.next()))){
            System.out.println("没找到");
        }else{
            for (Map.Entry x:e){
                if (x.getValue().equals(in.next())){
                    System.out.println(x.getKey());
                    System.out.println("找到了");
                }
            }
        }
    }
}
